/**
 *  @auth: sce
 *  @date: 17-12-29
 *  @desc: 计数器的reducer
 **/

function counter(state = {count : 0}, action) {
    const {count} = state;
    const {type} = action;
    switch (type) {
        case 'increase':
            return {
                ...state,
                count : count + 1
            };
        case 'subside':
            return {
                ...state,
                count: count -1
            };
        default:
            return state;
    }
}
export const action = {
    increaseAction: {
        type: 'increase'
    },
    subsideAction: {
        type: 'subside'
    }
};

export default counter;